package com.encrypt;


import org.apache.commons.codec.binary.Base64;

import java.nio.charset.StandardCharsets;

/**
 * @author zhangyan
 * @version $ Id: Base64Demo.java, v 0.1 2022/1/13 22:16 zhangyan Exp $
 */
public class Base64Demo {
    public static void main(String[] args) {
        //base64编码
        String value = "青砖伴瓦漆";
        System.out.println(Base64.encodeBase64String(value.getBytes(StandardCharsets.UTF_8)));
        //base64解码
        byte[] base64 = Base64.decodeBase64("6Z2S56CW5Ly055Om5ryG");
        System.out.println(new String(base64));
    }
}
